package com.xiexie.order.feign;

import com.xiexie.order.config.FeignConfig;
import feign.Param;
import feign.Request;
import feign.RequestLine;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @Description 添加feign接口和方法
 * name: 指定调用rest接口所对应的服务名
 * path: 指定调用rest接口所在的stockController所对应的@requestMapping
 * configuration: 如果想针对某个或某些服务进行openFeign调用，去掉@Configuration注解，并在此声明
 * @Date 2022-04-11 15:06
 * @Author xie
 */
@FeignClient(name = "stock-server", path = "/stock", configuration = FeignConfig.class)
public interface StockFeignService {

    @RequestMapping("/reduct")
    public String reduct();

    /**
     * 在openFeign中必须要指定参数名 @PathVariable("id")
     *
     * @param id
     * @return java.lang.String
     */
    @RequestMapping("/{id}")
    public String get(@PathVariable("id") Integer id);

    /**
     * 使用原生feign注解
     *
     * @param id
     * @return java.lang.String
     */
    //@RequestLine("GET /{id}")
    //public String get(@Param("id") Integer id);



}
